<?php
class ApplicationsModel extends Model {
	
	public function get_apps($where='') {
		if($where) {
			$arr = $this->where($where)->select();
		} else {
			$arr = $this->select();
		}
		foreach($arr as $k => $v) {
			if($tmp = common('String')->authcode($v['authkey'], 'DECODE', 'cs5H7Z2bbC9lfi6ift7DaDfQfH6r0U5M4C755l5K6908dD8Nahdz9U6YbX2E2J7Q')) {
				$v['authkey'] = $tmp;
			}
			$arr[$k] = $v;
		}
		return $arr;
	}
	
	function checkAppName($name,$uid=0) {
		$data ['appid'] = array (
				'neq',
				$uid
		);
		$data['name'] = $name;
		return $this->where($data)->find();
	}
}
?>